#pragma once
#include <chrono>

class CElapsedTimer {
public:
    CElapsedTimer() { reset(); }

    void reset() {
        m_startTime = std::chrono::steady_clock::now();
        m_isRunning = true;
    }

    int elapsed() const {
        if (!m_isRunning) return -1;
        auto endTime = std::chrono::steady_clock::now();
        std::chrono::duration<double, std::milli> elapsed_ms = endTime - m_startTime;
        return elapsed_ms.count();
    }

private:
    std::chrono::time_point<std::chrono::steady_clock> m_startTime;
    bool m_isRunning = false;
};